﻿cmake_minimum_required(VERSION 3.5)

project(cpp_demo VERSION 0.1 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
# 设置策略CMP0091为NEW，新策略
if (POLICY CMP0091)
	cmake_policy(SET CMP0091 NEW)
endif (POLICY CMP0091)

include(${CMAKE_SOURCE_DIR}/../../DAQ_IPC/DAQ_IPC.cmake)
set(PROJECT_SOURCES main.cpp once_trigger_thread/once_trigger_thread.cpp once_trigger_thread/once_trigger_thread.h)  

if (MSVC)
  add_compile_options("/utf-8")
elseif (UNIX)
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
endif()

set(DEMO_NAME "cpp_demo")
add_executable(${DEMO_NAME} ${PROJECT_SOURCES})
target_link_libraries(${DEMO_NAME} PRIVATE ${DAQ_IPC_DEPENDENT_LIBRARIES})
target_include_directories(${DEMO_NAME} PRIVATE ${DAQ_IPC_INCLUDE_DIRS})
target_include_directories(${DEMO_NAME} PRIVATE ${CMAKE_SOURCE_DIR})


include(GNUInstallDirs)
install(TARGETS ${DEMO_NAME}
    BUNDLE DESTINATION .
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
